{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "27638102",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\lenovo\\AppData\\Local\\Temp/ipykernel_33124/3609280948.py:23: RuntimeWarning: divide by zero encountered in true_divide\n",
      "  y2 = 1/x + x/2\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<matplotlib.legend.Legend at 0x1a6bf7cda00>"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXAAAAD4CAYAAAD1jb0+AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAwtElEQVR4nO3dd3hUVf7H8fdJDwkkpNBSCN0gnRBKKAmxYEPXtiK4KmBHsLC2ta66rrsuirqysujaddf2E5UqIYQaCL0E6aQRSCOF9Mz5/XExolJCMsmdO/N9PY8PyTCZ+xmET07OvecepbVGCCGE9biZHUAIIUTjSIELIYRFSYELIYRFSYELIYRFSYELIYRFebTkwUJCQnRUVFRLHlIIISxv48aN+Vrr0F8/3qIFHhUVRVpaWkseUgghLE8pdfh0j8sUihBCWJQUuBBCWJQUuBBCWJQUuBBCWJQUuBBCWJQUuBBCWNQ5C1wp9a5S6phSascpjwUppZYqpfae/LVt88YUQgjxaw0Zgb8HjPvVY48By7TWPYBlJz9vEauzVzNn65yWOpwQQjiscxa41joFKPzVw1cD75/8+H3gGvvGOrPU3FTmbZvXUocTQgiH1dg58PZa6yMAJ39td6YnKqXuVEqlKaXS8vLyGnm4n3m7e1Ntq0Y2ohBCuLpmP4mptZ6rtY7RWseEhv5mKf9583b3BqDaVt3k1xJCiGZxPBP+7z6oKm3WwzS2wI8qpToCnPz1mP0inZ2XmxcAVXVVLXVIIYRoGJs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nV8FvvWYRS6l2l1DGl1I5THgtSSi1VSu09+WtbexzL4Qu8pTdPdhC1wMNa62hgGHCfC7xngBkYtyZ2FbOBRVrrC4D+OPl7V0qFAdOBGK11H8AdYx8BZ/MeMO5Xjz0GLNNa9wCWnfy8yRy+wDll82StdTXw0+bJTktrfURrvenkx6UY/7DDzE3VvJRS4cAVwDyzs7QEpVQbYDTwDoDWulprfdzUUC3DA/BVSnkArXDCXby01ilA4a8evhp4/+TH7wPX2ONYVijwMCDzlM+zcPIyO5VSKgoYCKSaHKW5vQY8AthMztFSugJ5wH9OThvNU0r5mR2qOWmts4FXgAzgCFCstV5ibqoW015rfQSMARpw9u3uG8gKBd6gzZOdkVLKH/gSeEBrXWJ2nuailLoSOKa13mh2lhbkAQwC5mitBwInsNOP1Y7q5Lzv1UAXoBPgp5SaZG4qa7NCgbvk5slKKU+M8v5Ya/2V2XmaWRwwXil1CGOKbKxS6iNzIzW7LCBLa/3TT1ZfYBS6M7sIOKi1ztNa1wBfASNMztRSjiqlOgKc/PWYPV7UCgXucpsnK6UUxtxoutZ6ltl5mpvW+nGtdbjWOgrj/2+S1tqpR2Za61wgUynV6+RDicAuEyO1hAxgmFKq1cm/44k4+YnbU8wHbj358a3AN/Z4UYffUk1rXauU+mnzZHfgXRfYPDkOuAXYrpTacvKxJ07uQSqcx/3AxycHJgeA203O06y01qlKqS+ATRhXWm3GCZfUK6U+BeKBEKVUFvAM8Ffgf0qpKRjfyG6wy7FkKb0QQliTFaZQhBBCnIYUuBBCWJQUuBBCWJQUuBBCWJQUuBBCWJQUuBBCWJQUuBBCWNT/A3li2zxz5PBOAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "def calXnew(Xold):\n",
    "    return  1/Xold+Xold/2\n",
    "Xold = 10\n",
    "error = 1e-4\n",
    "i = 0\n",
    "maxIter = 50\n",
    "data = np.zeros((maxIter,4))\n",
    "while(i < maxIter):\n",
    "    Xnew = calXnew(Xold)\n",
    "    difference = abs(Xnew - Xold)\n",
    "    data[i,:]=[i,Xnew,Xold,difference]\n",
    "    data[i+1,:]=[i+1,Xnew,Xnew,difference]\n",
    "    i += 2\n",
    "    Xold = Xnew\n",
    "    if difference < error:\n",
    "        break\n",
    "plt.plot(data[:,2],data[:,1])\n",
    "x = np.arange(0,10,0.1)\n",
    "y1 = x\n",
    "plt.plot(x,y1,label='y=x')\n",
    "y2 = 1/x + x/2\n",
    "plt.plot(x,y2,label='1/x+x/2')\n",
    "plt.legend()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "d1612f5f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([10.        ,  5.1       ,  5.1       ,  2.74607843,  2.74607843,\n",
       "        1.73719487,  1.73719487,  1.44423809,  1.44423809,  1.41452566,\n",
       "        1.41452566,  1.4142136 ,  1.4142136 ,  1.41421356,  0.        ,\n",
       "        0.        ,  0.        ,  0.        ,  0.        ,  0.        ,\n",
       "        0.        ,  0.        ,  0.        ,  0.        ,  0.        ,\n",
       "        0.        ,  0.        ,  0.        ,  0.        ,  0.        ,\n",
       "        0.        ,  0.        ,  0.        ,  0.        ,  0.        ,\n",
       "        0.        ,  0.        ,  0.        ,  0.        ,  0.        ,\n",
       "        0.        ,  0.        ,  0.        ,  0.        ,  0.        ,\n",
       "        0.        ,  0.        ,  0.        ,  0.        ,  0.        ])"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data[:,2]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "4cd7ea2f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([5.1       , 5.1       , 2.74607843, 2.74607843, 1.73719487,\n",
       "       1.73719487, 1.44423809, 1.44423809, 1.41452566, 1.41452566,\n",
       "       1.4142136 , 1.4142136 , 1.41421356, 1.41421356, 0.        ,\n",
       "       0.        , 0.        , 0.        , 0.        , 0.        ,\n",
       "       0.        , 0.        , 0.        , 0.        , 0.        ,\n",
       "       0.        , 0.        , 0.        , 0.        , 0.        ,\n",
       "       0.        , 0.        , 0.        , 0.        , 0.        ,\n",
       "       0.        , 0.        , 0.        , 0.        , 0.        ,\n",
       "       0.        , 0.        , 0.        , 0.        , 0.        ,\n",
       "       0.        , 0.        , 0.        , 0.        , 0.        ])"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data[:,1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2af47754",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
